package Ppackage;

public class Main
{
    public static void main(String[] args)
    {
        Buffer buffer = new Buffer();

        // 创建生产者
        Thread producerA = new Thread(new Producer(buffer), "生产者A");
        Thread producerB = new Thread(new Producer(buffer), "生产者B");

        // 创建消费者
        Thread consumer1 = new Thread(new Consumer(buffer), "消费者1");
        Thread consumer2 = new Thread(new Consumer(buffer), "消费者2");
        Thread consumer3 = new Thread(new Consumer(buffer), "消费者3");

        // 启动线程
        producerA.start();
        producerB.start();
        consumer1.start();
        consumer2.start();
        consumer3.start();
    }
}
